package cn.jetpiece.cloud.joss.api.object;

import cn.jetpiece.cloud.joss.api.object.model.params.PutObject;
import cn.jetpiece.cloud.joss.api.object.model.result.OssSdkBaseResult;
import cn.jetpiece.cloud.joss.api.object.model.result.UploadObjectResult;
import cn.jetpiece.cloud.resource.annotation.annotation.ApiResource;
import cn.jetpiece.cloud.resource.annotation.annotation.ScanResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;


/**
 * 对象接口
 *
 * @author XuJZ
 * @since 2020-09-05 15:41:52
 */
@Api(tags = "对象")
@ApiResource(name = "对象")
public interface ObjectApi {

    /**
     * 上传对象
     *
     * @param putObject 对象信息
     * @return 对象信息
     */
    @ApiOperation(value = "文件上传")
    @ScanResource(name = "文件上传", path = "/oss/putObject/**", method = RequestMethod.PUT)
    OssSdkBaseResult<UploadObjectResult> putObject(PutObject putObject, @RequestParam(value = "file",required = false)  MultipartFile file);

    /**
     * 获取对象
     */
    @ApiOperation(value = "获取对象")
    @ScanResource(name = "获取对象", path = "/oss/getObject/**", method = RequestMethod.GET,requiredLogin = false)
    void getObject();

    /**
     * 删除对象
     */
    @ApiOperation(value = "删除对象")
    @ScanResource(name = "删除对象", path = "/oss/deleteObject/**", method = RequestMethod.DELETE)
    OssSdkBaseResult<String> deleteObject();

}
